package com.cmic.rcs.enhance.message.g5.core.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
public class Response {
    /**
     * 错误码，0为成功
     */
    protected Integer code;
    /**
     * 错误信息
     */
    protected String msg;

    public static Response Error(ReturnCodeEnum returnCodeEnum) {
        return new Response(returnCodeEnum.getCode(), returnCodeEnum.getMsg());
    }

    public static Response Error(ReturnCodeEnum returnCodeEnum, String msg) {
        return new Response(returnCodeEnum.getCode(), msg);
    }

    public static Response Error(int code, String msg) {
        return new Response(code, msg);
    }

    public static Response OK() {
        return new Response(ReturnCodeEnum.SUCCESS.getCode(), ReturnCodeEnum.SUCCESS.getMsg());
    }
}
